package com.huayun.code.core.model;

public class Column {

    /**
     * 字段名
     */
    private String name;

    /**
     * 属性名
     */
    private String fieldName;

    /**
     * 大写开头的属性名
     */
    private String capitalizeFieldName;

    /**
     * get方法名
     */
    private String getter;

    /**
     * set方法名
     */
    private String setter;

    /**
     * 数据库类型
     */
    private int jdbcType;

    /**
     * 数据库类型名称
     */
    private String jdbcTypeName;

    /**
     * 类型的列表,有数据库返回
     */
    private String columnTypeName;

    /**
     * Java类型
     */
    private Class<?> javaType;

    /**
     * 注释
     */
    private String comment;

    /**
     * 数据长度
     */
    private int size;

    /**
     * 默认值
     */
    private String defaultValue;

    /**
     * 是否是主键
     */
    private boolean isPrimaryKey;

    /**
     * 是否自增
     */
    private boolean isAutoincrement;

    /**
     * 能否为空
     */
    private boolean isNullable;
    /**
     * decimal 小数点
     */
    private int decimalDigits;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getCapitalizeFieldName() {
        return capitalizeFieldName;
    }

    public void setCapitalizeFieldName(String capitalizeFieldName) {
        this.capitalizeFieldName = capitalizeFieldName;
    }

    public String getGetter() {
        return getter;
    }

    public void setGetter(String getter) {
        this.getter = getter;
    }

    public String getSetter() {
        return setter;
    }

    public void setSetter(String setter) {
        this.setter = setter;
    }

    public int getJdbcType() {
        return jdbcType;
    }

    public void setJdbcType(int jdbcType) {
        this.jdbcType = jdbcType;
    }

    public String getJdbcTypeName() {
        return jdbcTypeName;
    }

    public void setJdbcTypeName(String jdbcTypeName) {
        this.jdbcTypeName = jdbcTypeName;
    }

    public String getColumnTypeName() {
        return columnTypeName;
    }

    public void setColumnTypeName(String columnTypeName) {
        this.columnTypeName = columnTypeName;
    }

    public Class<?> getJavaType() {
        return javaType;
    }

    public void setJavaType(Class<?> javaType) {
        this.javaType = javaType;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public boolean isJdbcCharacterColumn() {
        return String.class.equals(javaType);
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public boolean getIsAutoincrement() {
        return isAutoincrement;
    }

    public void setAutoincrement(boolean autoincrement) {
        isAutoincrement = autoincrement;
    }

    public boolean getIsPrimaryKey() {
        return isPrimaryKey;
    }

    public void setPrimaryKey(boolean primaryKey) {
        isPrimaryKey = primaryKey;
    }

    public boolean isPrimaryKey() {
        return isPrimaryKey;
    }

    public boolean isNullable() {
        return isNullable;
    }

    public void setNullable(boolean nullable) {
        isNullable = nullable;
    }

    public int getDecimalDigits() {
        return decimalDigits;
    }

    public void setDecimalDigits(int decimalDigits) {
        this.decimalDigits = decimalDigits;
    }

    @Override
    public String toString() {
        return "Column{" +
                "name='" + name + '\'' +
                ", fieldName='" + fieldName + '\'' +
                ", capitalizeFieldName='" + capitalizeFieldName + '\'' +
                ", getter='" + getter + '\'' +
                ", setter='" + setter + '\'' +
                ", jdbcType=" + jdbcType +
                ", jdbcTypeName='" + jdbcTypeName + '\'' +
                ", columnTypeName='" + columnTypeName + '\'' +
                ", javaType=" + javaType +
                ", comment='" + comment + '\'' +
                ", size=" + size +
                ", defaultValue='" + defaultValue + '\'' +
                ", isPrimaryKey=" + isPrimaryKey +
                ", isAutoincrement=" + isAutoincrement +
                ", isNullable=" + isNullable +
                ", decimalDigits=" + decimalDigits +
                '}';
    }
}
